<template>
    <base-dialog :title="'编号套红——'+dialogTitle" width="95%" v-bind="$attrs" v-on="$listeners"  top="10px" :noButton="true" ref="my-dialog">
        <div style="display:flex;overflow: hidden">
        <div  style="height:calc(100vh - 120px); overflow:hidden;flex: 1">
<!--            <taohong-iframe :row="row" ref="taohongiframe" :is-edit="true"></taohong-iframe>-->
        </div>
        <div style="width: 100px; padding-left: 10px">
            <square-button title="确认套红" icon="el-icon-check" @click="toSave" placement="top"  style="background-color:#04a65b; color: #ffffff"></square-button>
            <square-button title="一键套红" icon="el-icon-money" @click="toSubmit" placement="top" style="background-color:#b10411; color: #ffffff"></square-button>
            <square-button title="暂存" icon="el-icon-tickets" @click="toSaveFile" placement="top"></square-button>
            <square-button title="手动上传" icon="el-icon-upload2" @click="toUpload" placement="top"></square-button>
            <my-upload-file size="medium" style="display: none" :show-file-list="false" @callback="uploadSuccess" :data="fwh" plain ref="uploadBtn" :upload-url="uploadUrl">套红上传</my-upload-file>
            <square-button title="取消" icon="el-icon-circle-close" @click="toClose" placement="top"></square-button>
        </div>
        </div>
    </base-dialog>
</template>
<script>
    import BaseDialog from "@/components/Common/BaseDialog";
    import MyWord from "@/components/WorkFlowsDialog/DocumentCase/MyWord";
    import eventBus from "@/utils/eventBus";
    import MyUploadFile from "../../../components/Common/MyUploadFile";
    import qs from "qs";
    import SquareButton from "../../../components/WorkFlowsDialog/Case/SquareButton";
    export default {
        name:"TaohongDialog",
        components: {SquareButton, MyUploadFile, MyWord, BaseDialog},
        props:["row","fwh"],
        inject: ["dialogTitle"],
        data(){
            return {
                flag:false
            }
        },
        created() {
        },
        computed:{
          uploadUrl(){
              return "/api/document/"+this.row.id+"/upload_th/"
          },
        },
        methods:{
            toUpload(){
                this.$refs.uploadBtn.clickBtn()
            },
            toSubmit(is_draft){
                this.$refs["taohongiframe"].taohong(qs.stringify(this.fwh))
                this.flag = true
            },
            uploadSuccess(res){
                this.msgSuccess(res.msg);
                eventBus.$emit("reloadView")
                this.toClose()
            },
            toClose(){
                this.$refs["taohongiframe"].toClose()
                this.$refs["my-dialog"].handleClose()
            },
            toSave(){
                this.$refs["taohongiframe"].saveFile()
                eventBus.$emit("reloadView")
                this.toClose()
            },
            toSaveFile(){
                this.$refs["taohongiframe"].saveFileByWopi()
                this.toClose()
            }
        }
    }
</script>
<style lang="scss" scoped>
    ::v-deep.elformBox .el-dialog__body {
        padding-left: 10px;
        padding-right: 10px;
        padding-top: 10px;
        .el-form-item{
            margin-bottom: 0px;
        }
    }

</style>
